define([ "jquery" ], function(jq) {
	var urlForEmptyCode = null;
	var init = function(settings) {
		urlForEmptyCode = settings.urlForEmptyCode;
		//jq(function() {
			jq('#emptyCode').click(function() {
				var data = jq('input#m_code').val();
				if (data.length <= 0) {
					jq.messager('请先输入编码前缀，例如A1，Z9', '');
					return false;
				}
				var url = urlForEmptyCode + "/" + data;
				jq.post(url, function(data) {
					jq('input#m_code').val(data);
				});
				return false;
			});
		//});
	};
	return {
		init : init
	};
});